package com.crocodileQ.controller;

import com.crocodileQ.common.AppException;
import com.crocodileQ.common.PageResult;
import com.crocodileQ.common.R;
import com.crocodileQ.domain.VO.ArticleListVO;
import com.crocodileQ.domain.VO.AtlasVO;
import com.crocodileQ.domain.entity.Atlas;
import com.crocodileQ.enums.AppExceptionMsgEnum;
import com.crocodileQ.service.AtlasService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 鳄鱼杆
 */
@Slf4j
@RestController
@RequestMapping("/atlas")
public class AtlasController {

    @Autowired
    private AtlasService atlasService;


    /**
     * 分页查询图片
     * @return
     */
    @GetMapping("/atlasList")
    public R<PageResult<AtlasVO>> articleList(Integer pageNum, Integer pageSize, Long categoryId, String name){
        //判断参数
        if(pageNum <= 0 || pageSize <= 0){
            throw new AppException(AppExceptionMsgEnum.WRONG_PAGE_PARAM);
        }

        return atlasService.atlasList(pageNum,pageSize,categoryId,name);
    }
}
